<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type="text/css" rel="stylesheet">
    form {
    margin: 0;
    }
    .editor {
    margin-top: 5px;
    margin-bottom: 5px;
    }
    .ke-content {
    font-family: Courier New;
    font-size: 12px;
    background-color: #ffffff;
}

  </style>
  <script type="text/javascript" charset="utf-8" src="/kindeditor/kindeditor.js"></script>
  <script type="text/javascript">
    KE.show({
        id : 'question_description',
        resizeMode :1,
        cssPath : '/kindeditor/examples/index.css',
        items : [
        'undo', 'redo', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
        'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
        'insertunorderedlist']
    });
  </script>
</head>
<body>﻿<h1>添加题目</h1>
<% form_for(:test, :url => { :action => "create_question" }) do |f| %>
  <%= error_messages_for :test %>
    <%= hidden_field :test, :id%>
    <div>
      为<%= f.text_field :name %> 添加题目
      <hr/> 
      <!-- 题目 -->
      <% for @question in @questions %>
         <p>
             题目：<br/>
          <%= text_field_tag  "question[][title]" %><br />
        </p>
        <P>
          题目描述：<br/>
         <!--%= text_area "question[]", :description, :cols => 30, :rows => 2  %--><br />
         <textarea id="question_description" name="question[][description]" style="width:500px;height:200px;visibility:hidden;"></textarea>
            <!-- 选项 --> 
            </p>
            <p>
          选项及跳转：<br />
          <% for @choice in @choices %> 
          <% if @choice.question_id == @question.id %>
          选项 :  <%= text_field_tag "choice[][content]" %>
           <%= select("choice[]", "next_question_id", @test.questions.map{|q| [q.title, q.id]}) %>
            <br />
          <% end %>
          <% end %>
          <!-- 选项结束 -->
       </p>
      <br/>
     <% end %>
      <!-- 题目结束 -->
      
    </div>
  <p>
  <%= submit_tag "完成并保存" %><br/>

  
  </p>
<% end %>
</body>
